using System;
using System.Diagnostics;

namespace AUT.Util
{
    public class AssertionException : Exception
    {
        public AssertionException(string message)
            : base(message)
        {
        }
    }

    /* This class is partially copied from the AUT UnitTest Library only to 
     * keep the code changes in the CaseStudy sample to minimal .. 
     * 
     * The all other obvious methods like False, IsFalse, True, IsTrue, IsNull
     * etc .. are all available in the MbUnit.Framework.Assert Class ....
     * 
    */
    public class Assertion
    {

        /// <summary>
        /// if not true, throws Exception with the message ... 
        /// and also writes to the Application Trace Log
        /// </summary>
        /// <param name="mustBeTrue"></param>
        /// <param name="message"></param>
        public static void Assert(bool mustBeTrue, string message)
        {
            if (!mustBeTrue)
            {
                Trace.Write(message);
                throw (new AssertionException(message));
            }
        }


    }
}
